package com.wangfan.elasticsearch.service;

import com.wangfan.elasticsearch.model.Customer;
import com.wangfan.elasticsearch.repository.CustomerRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.awt.print.Book;
import java.util.Optional;

/**
 * Created by wangfan on 2017/6/21.
 */
@Service
public class CustomerService {
    @Autowired
   private CustomerRepository customerRepository;


    public Customer save(Customer customer) {
        return customerRepository.save(customer);
    }

    public void delete(Customer customer) {
        customerRepository.delete(customer);
    }

    public Optional<Customer> findOne(String id) {
        return customerRepository.findById(id);
    }

    public Iterable<Customer> findAll() {
        return customerRepository.findAll();
    }

}
